package d1_static_field;

public class Test {
    public static void main(String[] args) {
        //目标理解:static修饰的成员变量,也就是类变量,或者叫静态变量
        //1.类名.静态变量(推荐的方式)
        Student.name = "袁华";
        System.out.println(Student.name);

        //对象.静态变量(不推荐)
        Student s1 = new Student();
        s1.name = "马冬梅";//连编译器都不提示,可见多不推荐
        //打印操作
        System.out.println(s1.name);



        //对象.静态变量(不推荐)
        Student s2 = new Student();
        //打印操作
        System.out.println(s2.name);
        //2. 对象.实例变量
        // Student.age = 12;//报错
        s1.age = 23;
        s2.age = 18;
        System.out.println(s1.age);//23


    }
}
